/*
 * Copyright 2011 Clean GWT
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.cleangwt.validation.client.constraints;

import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import com.cleangwt.validation.client.Validation;

/**
 * Link between a constraint annotation and its constraint validation implementations.
 * <p/>
 * A given constraint annotation should be annotated by a <code>@Constraint</code> annotation which
 * refers to its list of constraint validation implementations.
 * 
 * @author Jess
 * @version 1.0
 * @since 1.0
 */
@Documented
@Target({ANNOTATION_TYPE})
@Retention(RUNTIME)
public @interface Constraint {
  /**
   * A ConstraintValidator to implements the constraint.
   * 
   * @return the ConstraintValidator classes implementing the constraint
   */
  public Class<? extends Validation> validatedBy();

  /**
   * The arguments to build the constructor of constraint validator that the {@link #validatedBy()}
   * is specified.
   * 
   * @return array of property that is defined in the constraint
   */
  public String[] args();
}